﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Threading.Tasks;
using Zombie.Services.Definitions;

namespace Zombie.Tests.Services
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethodMock()
        {
            using (var client = new InformationClient(new MockInfoService()))
            {
                client.Open();


            }
        }

        [TestMethod]
        public void TestMethod1()
        {
            using (var client = new InformationService.InformationServiceClient())
            {
                client.Open();
                var result = client.LogIncident(new InformationService.SessionToken(), new InformationService.ZombieSighting());
            }
        }

        [TestMethod]
        async public Task TestMethod2()
        {
            using (var client = new InformationClient())
            {
                client.Open();
                var result = await client.Channel.LogIncident(new SessionToken(), new ZombieSighting());
                Assert.AreEqual(5, result);
            }
        }


        [TestMethod]
        public void TestMethod3()
        {
            using (var client = new InformationService.InformationServiceClient())
            {
                client.Open();
                var result = client.ListZombieTypes();
                Assert.AreEqual("ninja", result[0].ZombieTypeName);
            }
        }


        [TestMethod]
        public void TestMethod4()
        {
            using (var client = new InformationClient())
            {
                client.Open();
                var result = client.Channel.ListZombieTypes().Result;
                Assert.AreEqual("ninja", result[0].ZombieTypeName);
            }
        }


        [TestMethod]
        public void TestMethod6()
        {
            using (var client = new InformationClient())
            {
                client.Open();
                var result = client.Channel.GetZombieTypeDetails(1).Result;
                Assert.AreEqual("ninja", result.ZombieTypeName);
                Assert.AreEqual("This is a detailed description", result.DetailedDescription);
                Assert.IsNotNull(result.ThumbnailImage);
                Assert.IsNotNull(result.LastSighted);
            }
        }

        [TestMethod]
        public void TestMethod7()
        {
            using (var client = new InformationClient())
            {
                client.Open();
                var result = client.Channel.ListZombieTypes().Result;
                Assert.AreEqual("ninja", result[0].ZombieTypeName);
                var result2 = (ZombieTypeDetails)result[0];
                Assert.AreEqual("This is a detailed description", result2.DetailedDescription);
            }

        }
    }

}
